﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DTO;
using System.Data.SqlClient;
namespace DAO
{
    public class DinhDangPhimDAO
    {
        public static List<DinhDangPhim> LayDSDinhDang()
        {
            List<DinhDangPhim> dsDinhDang = new List<DinhDangPhim>();
            SqlConnection cn;
            cn = DataProvider.ConnectionData();
            string strSQL;
            strSQL = "Select * From DinhDangPhim";
            SqlCommand cmd = new SqlCommand(strSQL, cn);
            SqlDataReader dr;
            dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                DinhDangPhim dd = new DinhDangPhim();
                dd.MaDinhDangPhim = (int)dr["MaDinhDangPhim"];
                dd.TenDinhDangPhim = (String)dr["TenDinhDangPhim"];
                dsDinhDang.Add(dd);
            }
            dr.Close();
            cn.Close();
            return dsDinhDang;
        }
    }
}
